#include "include/ToolBoxView.h"

ToolBoxView::ToolBoxView(ToolBox &toolBox){

    layout = new QVBoxLayout();
    for(int i=0; i< toolBox.m_Tools.size();i++){

        m_Buttons.push_back( new ToolButton(*toolBox.m_Tools.at(i)));
        connect(m_Buttons.back(), SIGNAL(Clicked(Tool&)), &toolBox, SLOT(SetSelectedTool(Tool&)));
        connect(m_Buttons.back(),SIGNAL(Clicked(Tool&)), this, SLOT(UpdateInspector(Tool&)));
        layout->addWidget(m_Buttons.back());
    }
    inspector   =   new QWidget();
    layout->addWidget(inspector);
    setLayout(layout);

}


void ToolBoxView::UpdateInspector(Tool &tool){
    layout->addWidget(tool.inspector);
    this->update();
}
